package com.immortal.core.module.log.handlers;

import org.aspectj.lang.JoinPoint;

/**
 * <p>Title: LogHandler</p>
 * <p>Description: TODO</p>
 *
 * @author xukk
 * @version 1.0
 * @date 2018/6/8
 */
public interface LogHandler<T, V> {
    /**
     * handlerBefore
     *
     * @param log
     * @param joinPoint
     * @return
     */
    default V handlerBefore(T log, JoinPoint joinPoint) {
        return null;
    }

    /**
     * handlerAfter
     *
     * @param log
     * @param joinPoint
     * @param o
     * @return
     */
    default V handlerAfter(T log, JoinPoint joinPoint, Object o) {
        return null;
    }

    /**
     * handlerAfterThrowing
     * handlerError
     *
     * @param log
     * @param joinPoint
     * @param error
     * @return
     */
    default V handlerAfterThrowing(T log, JoinPoint joinPoint, Throwable error) {
        return null;
    }

    /**
     * handlerAfterReturning
     *
     * @param log
     * @param joinPoint
     * @param returnVal
     * @return
     */
    default V handlerAfterReturning(T log, JoinPoint joinPoint, Object returnVal) {
        return null;
    }


}
